// FontLib.h: interface for the CFontLib class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_FONTLIB_H__6F16172B_6868_405A_A8AF_347CE2406F59__INCLUDED_)
#define AFX_FONTLIB_H__6F16172B_6868_405A_A8AF_347CE2406F59__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CFontLib  
{
	struct FontCache {
		HFONT	hfont;
		int		size;
		bool    bUnderLine;
        DWORD   dwWeight;
		char	face[255];

		BOOL	IsSame(int size, char * face,bool bUnderLine, DWORD weight) {
			if (this->hfont==NULL) return FALSE;
			if (this->size!=size) return FALSE;
			if (this->bUnderLine!=bUnderLine) return FALSE;
			if (strncmp(this->face, face, 255)!=0) return FALSE;
            if (this->dwWeight!=weight)  return FALSE;
			return TRUE;
		};
	};

public:
	HFONT CreateFont(int size, char * family);
	HFONT CreateFont(int size, char * family,BOOL bUnderLine);
    HFONT CreateFont(int size, char * family, BOOL bUnderLine, DWORD dwWeight);
	CFontLib();
	virtual ~CFontLib();

private:
	int /*m_head, */m_tail;
	FontCache m_cache[10];
};

extern CFontLib g_fonts;

#endif // !defined(AFX_FONTLIB_H__6F16172B_6868_405A_A8AF_347CE2406F59__INCLUDED_)
